package 剑指offer_leetcode;

public class 剑指Offer56_II_数组中数字出现的次数2 {
    public int singleNumber(int[] nums) {
        int[] res = new int[32];
        int k = 1;
        int num = 0;
        for(int i=0;i<32;i++){
            for(int j=0;j<nums.length;j++){
                if((nums[j] & k) != 0)
                    res[i]++;
            }
            res[i] = res[i] % 3;
            num = num + res[i] * k;
            k<<=1;
        }
        return num;
    }
}
